package com.foryou.system.modules.sys.controller;

import com.foryou.system.common.bootstrap.PageUtils;
import com.foryou.system.common.bootstrap.Query;
import com.foryou.system.common.controller.AbstractController;
import com.foryou.system.modules.sys.entity.SysLogEntity;
import com.foryou.system.modules.sys.service.SysLogService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * 系统日志
 *
 * Created by LJX
 * 2017/12/16 0016 下午 9:43
 */
@RestController
@RequestMapping("/sys/log")
public class SysLogController extends AbstractController {
	@Autowired
	private SysLogService sysLogService;
	
	/**
	 * 列表
	 */
	@RequestMapping("/list")
	@RequiresPermissions("sys:log:list")
	public PageUtils list(@RequestParam Map<String, Object> params){
		//查询列表数据
		Query query = new Query(params);
		List<SysLogEntity> sysLogList = sysLogService.queryList(query);
		int total = sysLogService.queryTotal(query);

		PageUtils pageUtil = new PageUtils(sysLogList, total);
		return pageUtil;
	}
	
}
